<?php

	global $HTTP_GET_VARS;
	global $HTTP_POST_VARS;
	global $account;
	global $account_state;
	global $error;
	global $sql_row, $sql, $sql_total;

	output('<p><b class="text_big">Hey, '.$_GET['account'].'</b><br />
	This site contains all information we\'ve recieved about you, no more, no less.<br /><br />');

	$register_slot = sql("SELECT * FROM distribution_register WHERE username = ".slash($_GET['account'])." ORDER by product, id DESC");
	
	
	if ( $sql_total[$register_slot] == 0 )
	{
		output('Seems like you haven\'t installed any of our products. What are you waiting for? <a href="'.ROOT.'../distribution/">Go install some!</a></p>');
	}
	else
	{	
		$feedback_slot = sql("SELECT * FROM `distribution_feedback` WHERE `username` = '".$_GET['account']."' ORDER BY posted DESC");
		
		if ( $sql_total[$feedback_slot] == 0 )
		{
			// Don't do anything			
		}
		else
		{	
			output('<b class="text_big">You have posted the following Feedback</b><br />Thanks for helping us improve our games. You have posted the following thoughts on them:<br/><br/>');	
			$counter=0;
			$total=0;
			do
			{
			
				//$sql_row[$register_slot]['progress']
				$sql_row[$feedback_slot]['text']=str_replace("\n","<br />\n",html2text($sql_row[$feedback_slot]['text']));
				
				output('<b>Feedback posted on '.$sql_row[$feedback_slot]['posted'].' by you about <a href="?action=showgame&amp;game='.$sql_row[$feedback_slot]['product'].'">'.$sql_row[$feedback_slot]['product'].'</a>');
				output('</b><br />'.$sql_row[$feedback_slot]['text'].'<br /><br />');				
	
				$counter+=1;
				sql_next($feedback_slot);
			}
			while ($counter<$sql_total[$feedback_slot]);
		}
		clearslot($feedback_slot);

	
		output('<b class="text_big">You have installed the following products:</b></p>');
		$counter=0;
		$lastproduct = '';		
		
		$keys			=	makedefaultkeywords();	
		dopage('Upload_StartRows',$keys);
		
		do
		{
			if (file_exists('scripts/'.$sql_row[$register_slot]['product'].'.php'))
			{
				include_once('scripts/'.$sql_row[$register_slot]['product'].'.php');
				$sql_row[$register_slot]['progress'] = $progress_id_to_value[$sql_row[$register_slot]['product']][$sql_row[$register_slot]['progress']];
			}
			if ( $sql_row[$register_slot]['installed'] == '0000-00-00 00:00:00')
			{
				$sql_row[$register_slot]['installed'] = 'N/A';
			}			
			if (!isset($logo_100x100[$sql_row[$register_slot]['product']]))
			{
				$logo_100x100[$sql_row[$register_slot]['product']]	=	0;
			}
	
			$keys			=	makedefaultkeywords();			
			$keys			=	makekeywords('name',$sql_row[$register_slot]['product'],$keys);
			if (isset($sql_row[$register_slot]['progress']) && strcmp($sql_row[$register_slot]['progress'],'') != 0)
			{
				$keys			=	makekeywords('desc','Your progress in this game is ' . $sql_row[$register_slot]['progress'].'.<br />'.'You installed this on ' . $sql_row[$register_slot]['installed'] .'.',$keys);
			}
			else
			{
				$keys			=	makekeywords('desc','You installed this on ' . $sql_row[$register_slot]['installed'] .'.',$keys);
			}
			$keys			=	makekeywords('url',ROOT . ROOT2ROOT . 'distribution/?action=showgame&amp;game='.$sql_row[$register_slot]['product'],$keys);					
			$keys			=	makekeywords('thumburl_100px',uploadid($logo_100x100[$sql_row[$register_slot]['product']]),$keys);
									
			dopage('upload_row',$keys);
			
			//output( '<a href="?action=showgame&amp;game='.$sql_row[$register_slot]['product'].'">'.$sql_row[$register_slot]['product'] . '</a> (Version ' . $sql_row[$register_slot]['version'] . ').<br />You installed this on ' . $sql_row[$register_slot]['installed'] .'. Your progress in this game is ' . $sql_row[$register_slot]['progress'] .'<br />');
			
			$counter+=1;		
			sql_next($register_slot);
		}
		while ($counter<$sql_total[$register_slot]);		
		
		$keys			=	makedefaultkeywords();		
		dopage('Upload_EndRows',$keys);
		
		clearslot($register_slot);
		
		
	}
?>